package com.example.library.repository;

import com.example.library.model.Book;
import com.example.library.model.BorrowRecord;
import com.example.library.model.User;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;
import java.util.Optional;

public interface BorrowRecordRepository extends JpaRepository<BorrowRecord, Long> {
    List<BorrowRecord> findByBook(Book book);
    List<BorrowRecord> findByUser(User user);
    Optional<BorrowRecord> findByBookAndReturnDateIsNull(Book book);
}